package com.sfy.sfypicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sfy.sfypicturebackend.model.dto.file.UploadPictureBatchRequest;
import com.sfy.sfypicturebackend.model.dto.picture.PictureEditRequest;
import com.sfy.sfypicturebackend.model.dto.picture.PictureQueryRequest;
import com.sfy.sfypicturebackend.model.dto.picture.PictureReviewRequest;
import com.sfy.sfypicturebackend.model.dto.picture.PictureUploadRequest;
import com.sfy.sfypicturebackend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sfy.sfypicturebackend.model.entity.User;
import com.sfy.sfypicturebackend.model.vo.picture.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
* @author sfy
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2024-12-18 20:42:24
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     *
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 获取查询包装类
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);


    /**
     * 获取题目封装类
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage,HttpServletRequest request);


    /**
     * 校验图片
     * @param picture
     * @return
     */
    void validPicture(Picture picture);


    /**
     * 编辑图片
     * @param pictureEditRequest
     * @param request
     */
    void editPicture(PictureEditRequest pictureEditRequest, HttpServletRequest request);

    /**
     * 图片审核
     *
     * @param pictureReviewRequest
     * @param loginUser
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);


    /**
     * 填充审核信息
     * @param picture
     * @param loginUser
     */
    void fillReviewParams(Picture picture,User loginUser);

    /**
     * 批量抓取图片并上传
     * @param uploadPictureBatchRequest
     * @param loginUser
     * @return
     */
    Integer uploadPictureBatch(UploadPictureBatchRequest uploadPictureBatchRequest,
                               User loginUser);


    /**
     * 删除图片
     * @param oldPicture
     */
    void clearPicture(Picture oldPicture);
}
